import cv2
image=cv2.imread('grad.png',cv2.IMREAD_GRAYSCALE)
cv2.imshow('Input',image)
kernel1=cv2.getStructuringElement(cv2.MORPH_RECT,(3,3))
eroded_img1=cv2.erode(image,kernel1)
cv2.imshow('Eroded(3*3',eroded_img1)
kernel2=cv2.getStructuringElement(cv2.MORPH_RECT,(5,5))
eroded_img2=cv2.erode(image,kernel2)
cv2.imshow('Eroded(5*5)',eroded_img2)
cv2.waitKey()
cv2.destroyAllWindows()